package cn.dujc.superkid.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import java.util.List;

import cn.dujc.core.adapter.BaseAdapter;
import cn.dujc.core.adapter.BaseViewHolder;
import cn.dujc.core.util.StringUtil;
import cn.dujc.superkid.R;
import cn.dujc.superkid.bean.CourseEntity;
import cn.dujc.superkid.utils.ImageLoadHelper;

/**
 * @author du
 * date 2018/8/1 下午10:28
 */
public class CourseAdapter extends BaseAdapter<CourseEntity> {

    public CourseAdapter(@Nullable List<CourseEntity> data) {
        super(data);
        mLayoutResId = R.layout.item_couse;
    }

    @Override
    protected void convert(BaseViewHolder helper, CourseEntity item) {
        ImageLoadHelper.loadImage((ImageView) helper.getView(R.id.item_iv_couse_image), item.getCover());
        helper.setText(R.id.item_tv_couse_title, item.getTitle());
        helper.setText(R.id.item_tv_couse_info, StringUtil.concat("共", item.getCourse_num(), "节，已有", item.getStudy_num(), "名学生学习"));
        helper.setText(R.id.item_tv_couse_grade, item.getCourse_type());
    }
}
